import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn,
  UpdateDateColumn,
} from "typeorm";

@Entity()
export class Admin {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    length: 20,
    comment: "用户姓名",
  })
  name: string;

  @Column({
    length: 50,
    comment: "账号",
  })
  account: string;

  @Column({ default: "", length: 50, comment: "邮箱" })
  email: string;

  @Column({ default: "", length: 11, comment: "手机号" })
  phone: string;

  @Column({
    length: 50,
    select: false,
    comment: "密码",
  })
  password: string;

  @Column({
    length: 8,
    select: false,
    comment: "密码盐",
  })
  salt: string;

  @Column({ default: "1", length: 2, comment: "账户状态 1 生效 非1 注销" })
  status: string;

  @Column({ default: "", comment: "权限key" })
  auth_key: string;

  @Column({ default: "", comment: "备注" })
  des: string;

  @CreateDateColumn({
    type: "datetime",
    comment: "创建时间",
  })
  create_at: Date;

  @UpdateDateColumn({
    type: "datetime",
    comment: "更新时间",
  })
  update_at: Date;
}
